/**
 * Created by yyj on 2015/10/28.
 */
$(function(){
	//点击提交按钮
	$('.press_btn1.Sub').click(function(){
        var password=$("#personPassword").val().trim();
        var newPassword=$("#newPersonPassword").val().trim();
        var newPassword2=$("#newPersonPassword2").val().trim();
        var personId=$("#personId").val().trim();
        if(newPassword==""||password==""||newPassword2==""){
        	layer.msg('密码不能为空！',{time:2000});
        }else if(newPassword != newPassword2){
        	layer.msg("两次输入的新密码不一致！",{time:2000});
        }
        else{
        	$.ajax({
            url:"editPassword.do",
            type:"post",
            dataType: 'json',
            data:{
        		"newPassword":newPassword,
        		"password":password,
        		"personId":personId
            },
            success:function(result){
            	if(result.data){
                    layer.msg('修改成功',{time:2000});
                    $("#personPassword").val("");
                    $("#newPersonPassword").val("");
                    $("#newPersonPassword2").val("");
                    //window.location.href="menuPersonList.do";
                }else{
                    layer.msg(result.errorMessage,{time:2000});
                }
            }
        });
        }
    })

    
   
    
    
});
